<?php 
$sort1=isset($_GET['sort'])?'&sort='.$_GET['sort']:'';
$cs=Yii::app()->clientScript;
$cs->registerScript('single_truck_exam_excel',<<<END
$("#excel").click(
function(){
	//alert($("form").attr('action'));
	var act=$("form").attr('action');
	$("form").attr('action',act+'&excel=1$sort1');
	$("form").attr('target','_blank');
	$("form").submit();
	$("form").attr('action',act);
	$("form").attr('target','');
}
);
/*
$('.dataGrid thead').css({
  position: 'absolute',
  width:1440
  });
  $(window).scroll(function(){
  $('.dataGrid thead').css({
  top:$(this).scrollTop()+$(this).height()-430,
  //left:$(this).scrollLeft()
  });
});*/
END
);
?>
<h2>单车考核</h2>
<?php echo CHtml::beginForm(array('single_truck_exam'),'post');?>
<table  style="margin: 0 auto;"  width="1380">
<tr><td>
	确认单号：<input type="text" name="keys[confirm_no]" size="9" value="<?php echo isset($_GET['keys']['confirm_no'])?$_GET['keys']['confirm_no']:'';?>"/>
	车牌号：<input type="text" name="keys[truck_plate_no]" size="7" value="<?php echo isset($_GET['keys']['truck_plate_no'])?$_GET['keys']['truck_plate_no']:'';?>"/>
	司机：<input type="text" name="keys[driver_name]" size="7" value="<?php echo isset($_GET['keys']['driver_name'])?$_GET['keys']['driver_name']:'';?>"/>
	业务日期：<input type="text" id="keys[s_date]" name="keys[s_date]" size="7" value="<?php echo isset($_GET['keys']['s_date'])?$_GET['keys']['s_date']:'';?>"/>
	<?php $this->widget('application.extensions.calendar.SCalendar',array('inputField'=>'keys[s_date]','ifFormat'=>'%Y-%m'));?>
	收入费用：<?php echo CHtml::dropDownList('keys[amount]', isset($_GET['keys']['amount'])?$_GET['keys']['amount']:'', array(''=>'全部','0'=>'未填写','1'=>'已填写'));?>
	模糊查询：<?php echo CHtml::radioButtonList('keys[blur]',isset($_GET['keys']['blur'])?$_GET['keys']['blur']:1,array(1=>'是',0=>'否'),array('separator'=>' '));?>
	<input type="submit" value="搜索"/>&nbsp;&nbsp;&nbsp;&nbsp;<input id="excel" type="button" value="输出excel文件"/>
</td></tr></table>
<?php echo CHtml::endForm();?>
<div style="height:30px;"> </div>
<table class="dataGrid" width="1380">
  <thead>
  <tr>
    <th width="100"><?php echo $sort->link('confirm_no'); ?></th>
    <th width="90"><?php echo $sort->link('appointment_time'); ?></th>
    <th width="90"><?php echo $sort->link('create_time'); ?></th>
    <th width="80"><?php echo $sort->link('loading_status'); ?></th>
    <th width="70"><?php echo $sort->link('truck_plate_no'); ?></th>
    <th width="100"><?php echo $sort->link('driver_name'); ?></th>
    <th width="100"><?php echo $sort->link('consignor_name'); ?></th>
    <th width="100"><?php echo $sort->link('origin'); ?></th>
    <th width="100"><?php echo $sort->link('destination'); ?></th>
    <th width="70"><?php echo $sort->link('total_amount'); ?></th>
    <th width="35"><?php echo $sort->link('return_paper'); ?></th>
    <th width="70"><?php echo $sort->link('driver_salary'); ?></th>
    <th width="70"><?php echo $sort->link('gas_fee'); ?></th>
    <th width="70"><?php echo $sort->link('bridge_charge'); ?></th>
    <th width="70"><?php echo $sort->link('amerce_cost'); ?></th>
    <th width="70"><?php echo $sort->link('extra_cost'); ?></th>
    <th width="175"><?php echo $sort->link('remark'); ?></th>
    
  </tr>
  </thead>
  <tbody>
<?php foreach($models as $n=>$model): ?>
  <tr class="<?php echo $n%2?'even':'odd';?>">
    <td><?php echo $model->confirm_no; ?></td>
    <td><?php echo CHtml::encode($model->appointment_time); ?></td>
    <td><?php echo CHtml::encode($model->create_time); ?></td>
    <td><?php echo CHtml::encode($model->getLoadingStatusName()); ?></td>
    <td><?php echo CHtml::encode($model->truck_plate_no); ?></td>
    <td><?php echo CHtml::encode($model->driver_name); ?></td>
    <td title="<?php echo $model->consignor_name;?>"><?php if(mb_strlen($model->consignor_name,'utf-8')>6) echo mb_substr($model->consignor_name,0,6,'utf-8').'...';else echo $model->consignor_name;?></td>
    <td title="<?php echo $model->origin;?>"><?php if(mb_strlen($model->origin,'utf-8')>6) echo mb_substr($model->origin,0,6,'utf-8').'...';else echo $model->origin;?></td>
    <td title="<?php echo $model->destination;?>"><?php if(mb_strlen($model->destination,'utf-8')>6) echo mb_substr($model->destination,0,6,'utf-8').'...';else echo $model->destination;?></td>
    <td><?php echo CHtml::encode($model->total_amount); ?></td>
    <td><?php echo CHtml::encode($model->getReturnPaperName()); ?></td>
    <td><?php echo CHtml::encode($model->driver_salary); ?></td>
    <td><?php echo CHtml::encode($model->gas_fee); ?></td>
    <td><?php echo CHtml::encode($model->bridge_charge); ?></td>
    <td><?php echo CHtml::encode($model->amerce_cost); ?></td>
    <td><?php echo CHtml::encode($model->getExtraCostName()); ?></td>
    <td title="<?php echo $model->remark;?>"><?php if(mb_strlen($model->remark,'utf-8')>13) echo mb_substr($model->remark,0,11,'utf-8').'...';else echo $model->remark;?></td>
  </tr>
<?php endforeach; ?>
  </tbody>
</table>
<br/>
<?php $this->widget('CLinkPager',array('pages'=>$pages,'htmlOptions'=>array('style'=>'width:1380px;'))); ?>
